#include "stdafx.h"
#include "Client.h"
#include "FightServer.h"
#include "CustomProtocal.h"

xgc_void CFightServer::StartServer( xgc_lpcstr address, xgc_uint16 port, xgc_uint16 test_invent, xgc_uint16 timeout )
{
	net::IMessageQueue **mQueue = GetMessageQueue();
	mServer = net::StartServer( address, port, mQueue, test_invent, timeout, ProtocalCustom, 10 );

	__super::Start();
}

xgc_void CFightServer::StopServer()
{
	net::CloseServer( mServer );
	__super::Stop();
}

void CFightServer::RegisteMessage()
{
	// RegistFunction( C2GT_GATE_MESSAGE_TYPE, C2GT_LOGIN_REQUEST, &ProcessLogin );
}

xgc_lpvoid CFightServer::OnAccept( net::network_t h, xgc_long_ptr from )
{
	return reinterpret_cast< xgc_lpvoid >( new CClient );
}

void CFightServer::OnClose( xgc_lpvoid userdata )
{
	delete reinterpret_cast< CClient* >( userdata );
}